home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98c.txt / 000049_icon-group-sender _Thu Sep 24 12:40:48 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id MAA05485
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Thu, 24 Sep 1998 12:40:42 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA14498; Thu, 24 Sep 1998 12:40:09 -0700
  7. Date: Thu, 24 Sep 1998 08:43:34 -0700
  8. From: swampler@noao.edu (Steve Wampler)
  9. Subject: Re: Possible to return a record from a loadable C func?
  10. To: sch@southeast.net
  11. Cc: icon-group@optima.CS.Arizona.EDU
  12. Message-Id: <swampler-9808241543.AA003129436@orpheus.gemini.edu>
  13. In-Reply-To: <6ucfk5$fh7@news.southeast.net>
  14. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  15. Status: RO
  16.  
  17.  
  18. Hi Todd - Writing a C function to return an Icon record type is possible
  19.    (*anything* is possible), but not easy.    If the record is defined
  20.    somewhere in the Icon code, it gets a little easier, as the run-time
  21.    system will know about the constructor.  Is that how you intend to
  22.    use it, or were you thinking about being able to return a record
  23.    whose definition is unknown to Icon before the C function is
  24.    called?
  25.  
  26.    If it's the 'simpler' of the two cases, have you written C functions
  27.    that return other Icon values (non-records) before?  How about
  28.    that return an aggragrete (set/table/list)?   I suspect you will much
  29.    better off if you've done both of these already, as most of the
  30.    fundamental operations will be familar to you and you can
  31.    concentrate on the record-specific stuff...
  32.  
  33.    I've never done what you need, so cannot offer anything concrete,
  34.    but the basic steps would be:
  35.  
  36.    (1) call the record constructor to allocate storage for the record (you will
  37.    probably have to wade through a fair amount of the runtime source
  38.    code to see how to do this...).  The record constructor routine will
  39.    handle most of the tough stuff for you.
  40.  
  41.    (2) fill in the fields with Icon values
  42.  
  43.    (3) return the record using the C-to-Icon function return support.
  44.  
  45.    Sorry this is so vague!
  46.  
  47.    If you want to *define* the record type (i.e. there is no "record" expression for that
  48.    type in the Icon code), you're on your own - that strikes me a *much* harder
  49.    problem.
  50.  
  51.  
  52.  
  53.  
  54. --
  55. Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
  56. The gods that smiled at your birth are now laughing openly. (Fortune Cookie)
  57.